package ace.cmp.jmockdata.config;

import ace.cmp.id.generator.api.LongIdGenerator;
import ace.cmp.id.generator.api.StringIdGenerator;
import ace.cmp.jmockdata.core.impl.util.JMockDataUtils;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author caspar
 * @date 2023/3/9 11:49
 */
@Configuration
public class JMockDataAutoConfig {

  @ConditionalOnBean({LongIdGenerator.class, StringIdGenerator.class})
  @ConditionalOnMissingBean
  @Bean
  public JMockDataUtils jMockDataUtils(
      LongIdGenerator longIdGenerator, StringIdGenerator stringIdGenerator) {
    return new JMockDataUtils(longIdGenerator, stringIdGenerator);
  }
}
